import request from "@/utils/request";
// ---------------菜单管理开始---------------
// 获取菜单树
export function menuList(data) {
    return request({
        url: "/sys/menu/treeList",
        method: "post",
        data
    });
}
// 创建菜单
export function creatMenu(data) {
    return request({
        url: "/sys/menu/create",
        method: "post",
        data
    });
}
// 修改菜单
export function updateMenu(id, data) {
    return request({
        url: `/sys/menu/update?id=${id}`,
        method: "put",
        data
    });
}
// 删除菜单
export function deleteMenu(id) {
    return request({
        url: `/sys/menu/delete?id=${id}`,
        method: "delete"
    });
}
// ---------------菜单管理结束---------------
// ---------------角色管理开始---------------
// 角色列表
export function roleList(data) {
    return request({
        url: "/sys/role/list",
        method: "post",
        data
    });
}
// 菜单权限
export function menuRoot(data) {
    return request({
        url: "/sys/menu/treeList",
        method: "post",
        data
    });
}
// 创建角色
export function createRole(data) {
    return request({
        url: "/sys/role/create",
        method: "post",
        data
    });
}
// 获取角色权限
export function getRoleRoot(id) {
    return request({
        url: `/sys/role/menuCodes?id=${id}`,
        method: "get"
    });
}
// 修改角色
export function updateRole(id, data) {
    return request({
        url: `/sys/role/update?id=${id}`,
        method: "put",
        data
    });
}
// 删除角色
export function deleteRole(id) {
    return request({
        url: `/sys/role/delete?id=${id}`,
        method: "delete"
    });
}
// ---------------角色管理结束---------------

// ---------------部门管理开始---------------
// 新增部门
export function depaAdd(data) {
    return request({
        url: "/sys/department/create",
        method: "post",
        data: data
    });
}
// 更新部门
export function depaUpdate(data, id) {
    return request({
        url: `/sys/department/update?id=${id}`,
        method: "post",
        data: data
    });
}
// 删除部门
export function depaDelete(id) {
    return request({
        url: `/sys/department/delete?id=${id}`,
        method: "DELETE"
    });
}
// ---------------部门管理结束---------------

// ---------------用户管理开始---------------
// 部门管理
export function depa(data) {
    return request({
        url: "/login",
        method: "post",
        data
    });
}

// 用户管理新增
export function user(data) {
    return request({
        url: "/sys/user/create",
        method: "post",
        data
    });
}
// 用户管理列表
export function userList(data) {
    return request({
        url: "/sys/user/list",
        method: "post",
        data
    });
}
// 获取部门
export function depaList(data) {
    return request({
        url: "sys/department/list",
        method: "post",
        data
    });
}
// 用户删除
export function deleteList(data) {
    return request({
        url: "/sys/user/delete",
        method: "DELETE",
        data
    });
}
// 用户更新状态
export function userStatus(data) {
    return request({
        url: "/sys/user/update-status",
        method: "post",
        data
    });
}
// 用户更新
export function userUpdate(data) {
    return request({
        url: "/sys/user/update",
        method: "post",
        data
    });
}
// 用户更新密码
export function userPwd(data) {
    return request({
        url: "/sys/user/resetPwd",
        method: "put",
        data
    });
}
// 判断手机号是否存在
export function existMobile(params) {
    return request({
        url: "/existMobile",
        method: "get",
        params
    });
}

// 判断邮箱是否存在
export function existEmail(params) {
    return request({
        url: "/existEmail",
        method: "get",
        params
    });
}
// ---------------用户管理结束---------------
// ---------------用户管理结束---------------
// ---------------用户管理结束---------------

// ---------------字典管理 start-------------
export function getDictionaryType() {
    return request({
        url: "/sys/dict/type-list",
        method: "get",
    });
}
export function getDictionary(data) {
    return request({
        url: "/sys/dict/list",
        method: "post",
        data
    });
}
export function createDiction(data) {
    return request({
        url: "/sys/dict/create",
        method: "post",
        data
    });
}
export function removeDicction(data) {
    return request({
        url: "/sys/dict/update",
        method: "put",
        data
    });
}
export function deleteDicction(data) {
    return request({
        url: "/sys/dict/delete?id=" + data,
        method: "delete"
    });
}

// ---------------字典管理 end---------------
// ---------------api管理开始----------------
// api列表
export function apiList() {
    return request({
        url: "/sys/api/list",
        method: "get"
    });
}
// 创建分类
export function createApi(data) {
    return request({
        url: "/sys/api/create",
        method: "post",
        data
    });
}
// 修改api
export function updateApi(id, data) {
    return request({
        url: `sys/api/update?id=${id}`,
        method: "put",
        data
    });
}
// 删除api
export function deleteApi(id) {
    return request({
        url: `/sys/api/delete?id=${id}`,
        method: "delete"
    });
}
// ---------------api管理结束----------------